package com.yanqu.road.server.cmd.activity.huashigang;

import com.yanqu.road.entity.player.UserBaseInfo;
import com.yanqu.road.logic.pb.PlayerBasePb;
import com.yanqu.road.pb.huashigang.HuaShiGangProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.cross.battle.HuaShiGangMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.CrossProtocol;

/**
 * @Author wpj
 * @Date 2020/10/7
 */
@Cmd(code = CrossProtocol.C2_HUA_SHI_GANG_OPEN_TREASURE, desc = "打开花石纲藏宝")
public class CrossOpenTreasureCmd extends CrossCommand {
    int treasureId;
    int activityId;
    UserBaseInfo userBaseInfo;
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        HuaShiGangProto.CrossOpenTreasureReqMsg msg = HuaShiGangProto.CrossOpenTreasureReqMsg.parseFrom(packet.getBytes());
        treasureId = msg.getTreasureId();
        activityId = msg.getActivityId();
        userBaseInfo = PlayerBasePb.parseToUserBaseInfo(msg.getPlayerInfo());
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        HuaShiGangMgr.openTreasure(activityId, serverId, packet.getPlayerId(), treasureId, userBaseInfo);
    }

    @Override
    public void sendData() {

    }

}
